package View.EmpresaView;

import java.awt.Dimension;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;

import Controller.EmpresaController.EmpresaController;
import Entidade.Empresa;
import framework.component.field.TTextField;
import framework.mvc.GenericView;

public class EmpresaView extends GenericView<Empresa> {

	private static final long serialVersionUID = -1378693519364175372L;
	private TTextField txtCnpj;
	private TTextField textField_1;
	private TTextField textField;
	private TTextField textField_2;
	private TTextField txtTelefone;

	public EmpresaView() {
		super(new EmpresaController());
		setTitle("Fox Empresarial - Cadastro de Empresas");
		setSize(new Dimension(414, 230));

		JLabel lblNome = new JLabel("Nome:");

		JLabel lblFantasia = new JLabel("Nome Fantasia:");

		JLabel lblCnpj = new JLabel("CNPJ:");

		JLabel lblInscEstadual = new JLabel("Insc. Estadual:");

		txtCnpj = new TTextField();
		txtCnpj.setName("NomeEmpresa");
		txtCnpj.setColumns(10);

		textField_1 = new TTextField();
		textField_1.setName("FantasiaEmpresa");
		textField_1.setColumns(10);

		textField = new TTextField();
		textField.setName("CNPJEmpresa");
		textField.setColumns(10);

		textField_2 = new TTextField();
		textField_2.setName("InscricaoEstadualEmpresa");
		textField_2.setColumns(10);

		JLabel lblTelefone = new JLabel("Telefone:");

		txtTelefone = new TTextField();
		txtTelefone.setName("TelefoneEmpresa");
		txtTelefone.setColumns(10);

		JButton button = new JButton("Salvar");
		button.setName("salvar");

		JButton button_1 = new JButton("Cancelar");
		button_1.setName("cancelar");
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout
				.setHorizontalGroup(groupLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								groupLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.TRAILING)
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addComponent(
																				button,
																				GroupLayout.PREFERRED_SIZE,
																				63,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(8)
																		.addComponent(
																				button_1,
																				GroupLayout.PREFERRED_SIZE,
																				75,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addGroup(
																				groupLayout
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addComponent(
																								lblNome)
																						.addComponent(
																								lblFantasia)
																						.addComponent(
																								lblCnpj)
																						.addComponent(
																								lblInscEstadual)
																						.addComponent(
																								lblTelefone))
																		.addGap(21)
																		.addGroup(
																				groupLayout
																						.createParallelGroup(
																								Alignment.LEADING,
																								false)
																						.addComponent(
																								txtTelefone)
																						.addComponent(
																								textField_2)
																						.addComponent(
																								textField)
																						.addComponent(
																								textField_1)
																						.addComponent(
																								txtCnpj,
																								GroupLayout.DEFAULT_SIZE,
																								279,
																								Short.MAX_VALUE))))
										.addContainerGap(52, Short.MAX_VALUE)));
		groupLayout
				.setVerticalGroup(groupLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								groupLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(lblNome)
														.addComponent(
																txtCnpj,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblFantasia)
														.addComponent(
																textField_1,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.UNRELATED)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(lblCnpj)
														.addComponent(
																textField,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.UNRELATED)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblInscEstadual)
														.addComponent(
																textField_2,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.UNRELATED)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																txtTelefone,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																lblTelefone))
										.addPreferredGap(
												ComponentPlacement.UNRELATED)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(button)
														.addComponent(button_1))
										.addContainerGap(78, Short.MAX_VALUE)));
		getContentPane().setLayout(groupLayout);
	}
}
